<?php
declare (strict_types = 1);

namespace app\admin\controller;
use app\BaseController;
use think\facade\Db;
use think\facade\Request;
use think\facade\view;

class Order extends BaseController
{
    public function orderList()
    {
        $post = Request::param();
        $where=[];
        if (isset($post['order_sn']) && $post['order_sn']<>'') $where[]=['order_sn','like',"%{$post['order_sn']}%"];
        if (isset($post['addtime']) && $post['addtime']<>'')    $where[]=['addtime','> TIME',$post['addtime']];
        if (isset($post['addtimes']) && $post['addtimes']<>'')  $where[]=['addtime','< TIME',$post['addtimes']];

        if (isset($post['d_price']) && $post['d_price'])    $where[]=['price','>',$post['d_price']];
        if (isset($post['g_price']) && $post['g_price'])    $where[]=['price','<',$post['g_price']];
        if (isset($post['cid']) && $post['cid'])    $where[]=['status','in',$post['cid']];


        $order=Db::table('ecm_order')
            ->where($where)
            ->paginate(['list_rows'=>5,'query'=>$post]);
        View::assign('order',$order);

        $user = Db::table('ecm_user')->select();
        View::assign('user',$user);
        //订单状态查询
        $statu = Db::table('ecm_order_status')->select();
        View::assign('statu',$statu);
        View::assign($post);
        return view();
    }

    public function orderDetail()
    {
        return view();
    }
}







